#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn=1000;

int main() {
#ifdef DEBUG
  freopen("in", "r", stdin);
  freopen("out", "w", stdout);
#endif

  static char map[2*maxn+1][2*maxn+1];
  static int up[maxn+3][maxn+3], down[maxn+3][maxn+3], left[maxn+3][maxn+3], right[maxn+3][maxn+3];
  static bool book[2*maxn+1][2*maxn+1];
  int n;
  scanf("%d", &n);
  getchar();
  for (int i=1; i<=n+1; i++) {
    for (int j=1; j<=n*2+1; j++) {
      map[i][j] = getchar();
    }
    getchar();
  }

  for (int i=1; i<=n+1; i++) {
    for (int j=1; j<=n+1; j++) {
      up[i][j] = map[i][j*2-1]=='|' ? up[i-1][j]+1 : 0;
      left[i][j] = map[i][j*2-2]=='_' ? left[i][j-1]+1: 0;
    }
  }
  for (int i=n+1; i>0; i--) {
    for (int j=n+1; j>0; j--) {
      down[i][j] = map[i+1][j*2-1]=='|' ? down[i+1][j]+1 : 0;
      right[i][j] = map[i][j*2]=='_' ? right[i][j+1]+1 : 0;
    }
  }

  int ans=0;
  for (int i=1; i<=n+1; i++) {
    for (int j=1; j<=n+1; j++) {
      int l, r;
      if (right[i][j]<=down[i][j]) {
	if (book[i][2*(j+right[i][j])]) {
	  continue;
	}
	l=right[i][j]+1, r=min(right[i][j]+1+right[i][right[i][j]+j+1], down[i][j]);
      } else {
	if (book[i+down[i][j]+1][j*2-1]) {
	  continue;
	}
	l=down[i][j]+1, r=min(down[i][j]+1+down[down[i][j]+i+1][j], right[i][j]);
      }
      for (int k=l; k<=r; k++) {
	if (down[i][j+k]>=k && right[i+k][j]>=k) {
	  if (right[i][j]<=down[i][j]) {
	    book[i][2*(j+right[i][j])] = true;
	  } else {
	    book[i+down[i][j]+1][j*2-1] = true;
	  }
	  ans++;
	  break;
	}
      }
    }
  }

  for (int i=1; i<=n+1; i++) {
    for (int j=1; j<=n+1; j++) {
      int l, r;
      if (left[i][j]<=up[i][j]) {
	if (book[i][2*(j-left[i][j]-1)]) {
	  continue;
	}
	l=left[i][j]+1, r=min(left[i][j]+1+left[i][j-left[i][j]-1], up[i][j]);
      } else {
	if (book[i-up[i][j]][j*2-1]) {
	  continue;
	}
	l=up[i][j]+1, r=min(up[i][j]+1+up[i-up[i][j]-1][j], left[i][j]);
      }
      for (int k=l; k<=r; k++) {
	if (up[i][j-k]>=k && left[i-k][j]>=k) {
	  if (left[i][j]<=up[i][j]) {
	    book[i][2*(j-left[i][j]-1)] = true;
	  } else {
	    book[i-up[i][j]][j*2-1] = true;
	  }
	  ans++;
	  break;
	}
      }	
    }
  }

  printf("%d", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
